package com.dong.cloud.controller;

import com.dong.cloud.feign.PaymentFeignService;
import com.dong.springcloud.entities.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author DJ
 * @description
 * @date 2022/1/12 10:25 下午
 **/
@RestController
@Slf4j
public class OrderFeignController {

    @Resource
    PaymentFeignService paymentFeignService;

    @GetMapping("consumer/payment/feign/get/{id}")
    public CommonResult getPaymentById(@PathVariable(value = "id") Long id) {
        return paymentFeignService.getPaymentById(id);
    }

    @GetMapping("payment/feign/timeout")
    public String feignTimeout() {
        // feign底层整合了ribbon， 客户端默认超时时间是1s，这个接口访问时间超过1s就会超时
        return paymentFeignService.feignTimeout();
    }
}
